package com.thinkingcoder.tccache.core.command.string;

import static com.thinkingcoder.tccache.constant.CommandConstants.StringCmd.MSET;
import static com.thinkingcoder.tccache.constant.EncodeConstants.OK;

import com.thinkingcoder.tccache.core.command.Command;
import com.thinkingcoder.tccache.core.model.Reply;
import com.thinkingcoder.tccache.core.TcCache;

/**
 * MSET command.
 */
public class MSetCmd implements Command {
    @Override
    public String name() {
        return MSET;
    }

    @Override
    public Reply<?> exec(TcCache cache, String[] args) {
        String[] keys = getKeys(args);
        String[] values = getValues(args);
        cache.mSet(keys, values);
        return Reply.string(OK);
    }

}
